package jike.demo29.utils;

/**
 * @param
 * @author oyz
 * @version 1.0.4
 * @description:
 * @date 2023/4/16 11:41
 */
public class RedisDistributedLock {

    private RedisDistributedLock(){};


    private static RedisDistributedLock redisDistributedLock;



    public static RedisDistributedLock getSingletonIntance(){
        synchronized (RedisDistributedLock.class){
            if(redisDistributedLock == null){
                redisDistributedLock = new RedisDistributedLock();
            }
            return redisDistributedLock;
        }
    }


    public boolean lockTransction(Long id) {
        // 业务逻辑自己定义
        if(id%2 == 0){
            return true;
        }else{
            return false;
        }

    }

    public void unlockTransction(Long id) {
        // 释放当前事务
    }
}
